
<?php include_once("header.html")?>


<div id="wrap">  <br />
  <div class="tabsA">
    	<div class="left">
        	<div class="right"><?php echo lang('shopper_login')?></div>
    </div>
      <div class="des"><?php echo lang('notyet_signup')?> <a href="<?php echo $www_site_url?>/index.php/passport/reg"><?php echo lang('signup')?></a>！</div>
  </div>
  <div class="regInfo">
  
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
<FORM name="loginform" id="loginform" method="POST" onsubmit="return checkOnSubmit('loginform', rules);" >
<input type="hidden" name="action" value="passport">
<input type="hidden" name="op" value="dologin">
<input type="hidden" name="forward" value="<?php echo $forward?>">
<input type="hidden" name="s" id="s" value="">
<TABLE  width="100%" border="0" cellspacing="0" cellpadding="0">

<TR><TD width="40%" class="text"></TD>
<TD width="60%"><div id="msg"></div></TD></TR>
<TR><TD width="40%" class="text"><?php echo lang('email')?>:</TD>
<TD width="60%"><div id="errorsDiv_user"></div><INPUT class="input" type="text" name="user" value="" onfocus="this.value='';"/>&nbsp;&nbsp;</TD></TR>
<TR><TD class="text"><?php echo lang('pwd')?>:</TD>
<TD><div id="errorsDiv_password"></div><INPUT class="input" type="password" name="password" onclick="this.value='';"/>&nbsp;&nbsp;</TD></TR>
<?php if($show_code>3){?>
<TR><TD></TD><TD></TD></TR>
<TR><TD><?php echo lang('validatecode')?>:</TD>
<TD><div id="errorsDiv_code"></div><INPUT class="input" type="text" name="code" style="width:60px" /><img id="codeimg" src="<?php echo $www_site_url?>/index.php/identifycode/generate" align="absmiddle" title="<?php echo lang('anotherone')?>" onClick="changeCode();" style="cursor:pointer"> <span onClick="changeCode();" style="cursor:pointer"><?php echo lang('notclear')?></span></TD></TR>
<?php }?>
<TR><TD class="text">&nbsp;</TD><TD><INPUT  class="checkbox" type="checkbox" name="remember" value="1"/> <?php echo lang('autologin')?>&nbsp;&nbsp;<span id="errorsDiv_remember"></span></TD></TR>
<tr>
        <td class="text">&nbsp;</td>
        <td><a href="<?php echo $www_site_url?>/index.php/passport/forget"><?php echo lang('lostpassword');?></a></td>

</tr>

<TR> <td class="text">&nbsp;</td>
<TD ><input name="button" type="submit" class="btn" id="button" value="<?php echo lang('logon')?>" />
</TD><TD></TD></TR>
</TABLE>
</form>

<SCRIPT>
//only for test purposes
var _key = "<?php echo $_XppassSignKey?>";
function checkOnSubmit(formName, r) {
  
    if (yav.performCheck(formName, r, 'inline')) {
    	document.getElementById(formName).password.value = hex_md5(document.getElementById(formName).password.value);
    	document.getElementById(formName).s.value = hex_hmac_md5(_key,document.getElementById(formName).password.value);
    	
		var url = "<?php echo $www_site_url?>/index.php";
		var params = mini.form.serialize($(formName));
		mini.ajax.post(url, function(r){
			var r = eval('(' + r + ')');   
			if(r.s==200){
				window.location.replace(r.d);
			}
			if(r.s==400){
				if(r.m=='reload') window.location.reload();
				else $('msg').innerHTML = r.m;			
			}
		}, params);
    	
    	return false;
    } 
    return false;
}
function changeCode() {
	var num = 	new Date().getTime();
	var rand = Math.round(Math.random() * 10000);
	num = num + rand;
	document.getElementById("codeimg").src = "<?php echo $www_site_url?>/index.php/identifycode/generate/" + num;
	return false;
}
var rules=new Array();

rules[0]='user|required|<?php echo lang('helpmsg1')?>';
rules[1]='password|required|<?php echo lang('helpmsg2')?>';
<?php if($show_code){?>
rules[2]='code|required|<?php echo lang('coderule')?>';
<?php }?>


yav.addHelp('user', '');
yav.addHelp('password', '');
window.onload = function()
                {
                	yav.init('loginform', rules);
                          // Not coming here at all on first shot   
                }

</SCRIPT>
<p>&nbsp;</p>
  </div>
</div>
</div>
<?php include_once("footer.html")?>
